﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BusinessLayer;

namespace PresentationLayer
{
    public partial class HabilitarFuncionario : Form
    {
        public HabilitarFuncionario()
        {
            InitializeComponent();
        }

        private void HabilitarFunc_Click(object sender, EventArgs e)
        {
            this.txtBoxIDActo.SelectAll();
            this.txtBoxIDDep.SelectAll();
            this.txtBoxIDFunc.SelectAll();
            this.txtBoxIDOfic.SelectAll();

            String acto, dep, ofic, func;
            if ((acto = this.txtBoxIDActo.SelectedText) == "" ||
                (dep = this.txtBoxIDDep.SelectedText) == "" ||
                (ofic = this.txtBoxIDOfic.SelectedText) == "" ||
                (func = this.txtBoxIDFunc.SelectedText) == "")
            {
                MessageBox.Show("Todos os dados são obrigatorios");
                return;
            }

            if(FuncionarioActions.HabilitarFuncionario(func,ofic,dep,acto))
                this.Close();
        }
    }
}
